import dva from 'dva';
import { createHashHistory } from 'history';
import createLoading from 'dva-loading';
import './index.css';

// 1. Initialize
const app = dva({
  history: createHashHistory(), // hash mode
  onError(e) {
    console.error(e.message);
  },
});

// 2. Plugins
app.use(createLoading());

// 3. Model
app.model(require('./models/user').default);
app.model(require('./models/chat').default);
// 4. Router
app.router(require('./router').default);

// 5. Start
app.start('#root');
